package cn.com.surker.report.bean;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.util.ArrayList;
import java.util.List;

/**
 * excel中的单个工作薄
 *
 * @author luotao
 * @date 2024/5/15
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class ExcelSheet {

	/**
	 * 工作薄名
	 */
	private String sheetName;

	/**
	 * 表名
	 */
	private String tableName;

	/**
	 * 表名所在起始行
	 */
	private int tableNameFirstRow;

	private int tableNameEndRow;

	/**
	 * 表名所占列
	 */
	private int tableNameEndCell;

	/**
	 * 表名样式
	 */
	private ExcelStyle tableStyle;

	/**
	 * 表名高
	 */
	private short tableHeight;

	/**
	 * 对应的行
	 */
	private List<ExcelRow> rows;

	private List<ExcelCellWidth> widths;

	/**
	 * 筛选的行
	 */
	private String rangeAddress;

	public void addCellWidth(int cellNum, short width) {
		if (widths == null) {
			widths = new ArrayList<>();
		}
		ExcelCellWidth cellWidth = new ExcelCellWidth(cellNum, width);
		widths.add(cellWidth);
	}

	public void setCellWidth(List<ExcelCellWidth> cellWidths) {
		if (cellWidths == null || cellWidths.isEmpty()) {
			return;
		}
		widths = cellWidths;
	}

}
